
package vu.cs.heuristieken;

public abstract class House extends Entity {
    private int vrijstand;
    private int requiredVrijstand;
    private int price;
    private int priceIncrease;

    public House(Size size, boolean rotated, int vrijstand, int requiredVrijstand, int price, int priceIncrease) {
        super(size, rotated);
        this.vrijstand         = vrijstand;
        this.requiredVrijstand = requiredVrijstand;
        this.price             = price;
        this.priceIncrease     = priceIncrease;
    }

    public int getVrijstand() {
        return this.vrijstand;
    }

    public int getValue() {
        if(this.vrijstand >= this.requiredVrijstand) {
            return this.price + this._getBonusValue(this.price, this.priceIncrease, this.requiredVrijstand, this.vrijstand);
        }
        else {
            return this.price;
        }
    }

    // TODO: Test this.
    private int _getBonusValue(int price, int priceIncrease, int requiredVrijstand, int vrijstand) {
        return price * priceIncrease * (int) Math.floor((this.vrijstand - this.requiredVrijstand) / 2);
    }

    public House clone() 
        throws CloneNotSupportedException {
        return (House) super.clone();
    }
}
